#!/bin/bash


#data_date=$1
add_sql="insert overwrite table jtp_oms_ads.ads_order_daily_report
         select * from jtp_oms_ads.ads_order_daily_report
         union
         select
             '2025-01-01' as dt,
             sum(total_amount) as gmv,
             sum(pay_amount) as pay_amount,
             sum(coupon_amount) as coupon_amount,
             sum(promotion_amount) as promotion_amount,
             sum(integration_amount) as integration_amount,
             count(1) as order_count,
             count(distinct member_id) as order_user_count
         from jtp_oms_dwd.dwd_oms_order_incr
         where dt = '${data_date}';
"

/opt/module/spark/bin/beeline -u jdbc:hive2://node101:10001 -n bwie -e "${add_sql}"